#ifndef PRIMITIVE_H
#define PRIMITIVE_H

#include "DirectXEngine.h"

#define FVF (D3DFVF_XYZ | D3DFVF_DIFFUSE)
#define POINT D3DPT_POINTLIST
#define TRIANGLE D3DPT_TRIANGLELIST

struct Vertex 
{ 
	float X, Y, Z;
	DWORD Color;
	
	Vertex (float x = 0.0f, float y = 0.0f, float z = 0.0f, DWORD color = D3DCOLOR_RGBA(255, 255, 255, 0))
		{ X = x; Y = y; Z = z; Color = color; }
};

class Primitive
{
	public:
		Primitive (int Numverts, LPDIRECT3DDEVICE9 DrawDevice);
		~Primitive (void);

		void Draw (D3DPRIMITIVETYPE Type, int NumPrims);
		void SetVert (UINT Vert, Vertex& NewVert);
		void SetVertList (Vertex* List[]);
		void SetDrawDevice (LPDIRECT3DDEVICE9 DrawDevice);

		void Rotate (float Xdeg, float Ydeg, float Zdeg);
		void Translate (float X, float Y, float Z);
		void Scale (float XVal, float YVal, float ZVal);

		void ZeroTransformation (void);

	protected:
		void BuildBuffer (void);

		Vertex* VertList;
		UINT NumVerts;
		LPDIRECT3DVERTEXBUFFER9 VertBuffer;
		LPDIRECT3DDEVICE9 Device;
		D3DXMATRIX Translation;
		D3DXMATRIX Rotation;
		D3DXMATRIX Scalar;
		D3DXMATRIX Transformation;
		void* Pvoid;
};

#endif